<?php
PageUtil::addVar("javascript","<script src=\"http://code.jquery.com/jquery.js\"></script>");
PageUtil::addVar("javascript","<script src=\"http://code.jquery.com/ui/1.10.3/jquery-ui.js\"></script>");
PageUtil::addVar("stylesheet","<link href=\"".$stylepath."/category.css\" rel=\"stylesheet\">");
?>
{_include admin_menu}
<div class="content_block col-xs-12 col-sm-12 col-md-12 col-lg-12">
  <form method="post" action="<?php echo base_url('admin/category/orderupdate'); ?>" class="form-horizontal">
      <h2>จัดการหมวดหมู่ <a style="float:right;" href="<?php echo base_url('admin/category/add'); ?>" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span></a></h2>
      <table class="table table-hover" >
        <thead>
          <tr>
            <th class="col-sm-1">รหัส</th>
            <th class="col-sm-6">ชื่อ</th>
            <th class="col-sm-2">เรียง</th>
            <th class="col-sm-3">ตัวเลือก</th>
          </tr>
        </thead>
        <tbody>
          <?php
            echo Util::buildCategoriesTableList(0,$categories);
          ?>
        </tbody>
      </table>

      <input type="submit" name="submit" value="submit" class="btn btn-primary" >

  </form>

  <script type="text/javascript">
    $('a.keep').click(function () {
      var cls = $(this).attr("children");
      $("tr."+cls).toggle(200);
      return false;
    });

    $('tbody tr').each(function () {
      if(!$(this).hasClass('children0')){
        $(this).toggle(200);
      }
    });
  </script>
</div>